package com.nuoniu.sibanyun.controller.crm;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.CrmPhrase;
import com.nuoniu.sibanyun.entity.dto.CrmPhraseDto;
import com.nuoniu.sibanyun.service.crm.ICrmPhraseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 快捷短语 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-07-16
 */
@RestController
@RequestMapping("/crm/phrase")
@Api(value = "快捷短语",tags = "快捷短语")
public class CrmPhraseController extends BaseController {

    @Autowired
    private ICrmPhraseService crmPhraseService;


    @GetMapping("list")
    @ApiOperation(value = "获取联系记录快速短语")
    public HttpResult list(CrmPhraseDto crmPhraseDto){
        return HttpResult.ok(crmPhraseService.listCrmPhrase(crmPhraseDto));
    }


    @PostMapping("batchSave")
    public HttpResult batchSave(@RequestBody List<CrmPhraseDto> crmPhraseDtos){
        crmPhraseService.batchSave(crmPhraseDtos);
        return HttpResult.ok();
    }
    /**
     * 删除快速
     */
    @DeleteMapping("batchDelete")
    public HttpResult delete(String ids) {
        crmPhraseService.batchDelete(ids);
        return HttpResult.ok();
    }

}
